<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="../../css/index.css" />
		<script src="../../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/vant.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/ajax.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/xback.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../../css/person.css"/>
		<script src="html5plus://ready"></script>
		<style type="text/css">
			body{
				background-color:whitesmoke;
			}
		</style>
	</head>
	<body>
		<div id="app" >
			<van-row>
				<van-nav-bar id="header" title="我的收藏" left-arrow  @click-left="back"></van-nav-bar>
			</van-row>
			<van-row>
				<van-col span="24" style="background-color: white;" v-show="!show">
					<van-col offset="1" span="24">
						<div style="float:left;	width: 3px;margin-top:5px;height:30px;background-color: blue;"></div><!-- 画竖线 -->
						<div style="font-size: 18px;line-height:40px;">我的收藏</div>
					</van-col>
				</van-col>
			</van-row>
			<van-row>
				<van-col v-for="(u,i) in Goods" offset="1" span="22" style="margin-top:10px;border-radius:20px ;border: 1px solid red;">
					<van-card
					  v-bind:price="u.RealPrice"
					  v-bind:title="u.GoodsName"
					  desc=""
					  v-bind:origin-price="u.MarketPrice"
					  id="u.Id"
					  style="border-radius:30px ;border: 1px solid cyan;"
					  @click="GetId(i)"
					>
					<img v-bind:src="u.GoodsImageUrl" onerror="javascript:this.src='../../img/insert.png';onerror=null; "  slot="thumb">
				</van-col>
				<van-col span="24">
					<span v-show="show" style="font-size: 20px;color: #C8C9CC;position: relative;top: 200px;left: 10px;">暂无收藏，快去收藏自己喜欢的宝贝吧！</span>
				</van-col>
			</van-row> 
		</div>
		<script type="text/javascript">
			var vm=new Vue({
				el:"#app",
				data:{
					Goods:"",
					key:"",
					show:true,
				},
				mounted(){
					var _this=this;
					_this.$toast.loading({
						duration: 0,       // 持续展示 toast
						forbidClick: true, // 禁用背景点击
						loadingType: 'spinner',
						mask:true,
						message: '加载中,请稍后...'
					});
					setTimeout(function(){
						_this.$toast.clear();
					},500);
					_this.key=localStorage.getItem("keys");
					ajax({
						type:"post",
						url:"http://dsapi.ysd3g.com/api/MyGoodsCollectList",
						dataType:"JSONP",
						data:{
							p:1,
							key:_this.key
						},
						success:function(res){
							_this.Goods=res.Data;
							if(res.Data.length){
								_this.show=!_this.show;
							}
						}
					}),
					plus.key.addEventListener("backbutton",function(){  
						var wv = plus.webview.currentWebview();
						plus.webview.close(wv.id);
					});  
				},
				methods:{
					back(){
						plus.webview.close("MyCollected");
					},
					GetId:function(res){
						var _this=this;
						var x=_this.Goods[res].GoodsId;
						var w=plus.webview.create("../../views/Goodsdetail.html","vm.Goods[res].Id",{
							zindex:2
						},{Id:x});
						plus.webview.show("vm.Goods[res].Id");
					},
				}
			})
		</script>
	</body>
</html>
